home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
mscheap2
/
heapdbg.h
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-11
|
10KB
|
255 lines
/*/
Copyright (c) 1990 by Optimal Software, All Rights Reserved
/*/
#if !defined( HEAPDBG_H )
#define HEAPDBG_H
#if !defined( FILE )
#include <stdio.h>
#endif
/********** Function prototypes and aliases **********/
#define DBG_ARGS char near *file, uint line, FILE *stream
extern void *cdecl calloc_d( size_t nitems, size_t nbytes, DBG_ARGS );
extern void *cdecl calloc_t( size_t nitems, size_t nbytes, DBG_ARGS );
extern void *cdecl _expand_d( void *ptr, size_t nbytes, DBG_ARGS );
extern void *cdecl _expand_t( void *ptr, size_t nbytes, DBG_ARGS );
extern void far *cdecl _fcalloc_d( size_t nitems, size_t nbytes, DBG_ARGS );
extern void far *cdecl _fcalloc_t( size_t nitems, size_t nbytes, DBG_ARGS );
extern void far *cdecl _fexpand_d( void far *ptr, size_t nbytes, DBG_ARGS );
extern void far *cdecl _fexpand_t( void far *ptr, size_t nbytes, DBG_ARGS );
extern void cdecl _ffree_d( void far *ptr, DBG_ARGS );
extern void cdecl _ffree_t( void far *ptr, DBG_ARGS );
extern int cdecl _fheappack_d( DBG_ARGS );
extern int cdecl _fheappack_t( DBG_ARGS );
extern void far *cdecl _fmalloc_d( size_t nbytes, DBG_ARGS );
extern void far *cdecl _fmalloc_t( size_t nbytes, DBG_ARGS );
extern void far *cdecl _frealloc_d( void far *ptr, size_t nbytes, DBG_ARGS );
extern void far *cdecl _frealloc_t( void far *ptr, size_t nbytes, DBG_ARGS );
extern void cdecl free_d( void *ptr, DBG_ARGS );
extern void cdecl free_t( void *ptr, DBG_ARGS );
extern void far *cdecl _frelocate_d( void far *ptr, DBG_ARGS );
extern void far *cdecl _frelocate_t( void far *ptr, DBG_ARGS );
extern void huge *cdecl _hcalloc_d( long nitems, size_t nbytes, DBG_ARGS );
extern void huge *cdecl _hcalloc_t( long nitems, size_t nbytes, DBG_ARGS );
extern int cdecl _heappack_d( DBG_ARGS );
extern int cdecl _heappack_t( DBG_ARGS );
extern void huge *cdecl _hexpand_d( void huge *ptr, long nbytes, DBG_ARGS );
extern void huge *cdecl _hexpand_t( void huge *ptr, long nbytes, DBG_ARGS );
extern void cdecl _hfree_d( void huge *ptr, DBG_ARGS );
extern void cdecl _hfree_t( void huge *ptr, DBG_ARGS );
extern int cdecl _hheappack_d( DBG_ARGS );
extern int cdecl _hheappack_t( DBG_ARGS );
extern void huge *cdecl _hmalloc_d( long nbytes, DBG_ARGS );
extern void huge *cdecl _hmalloc_t( long nbytes, DBG_ARGS );
extern void huge *cdecl _hrealloc_d( void huge *ptr, long nbytes, DBG_ARGS );
extern void huge *cdecl _hrealloc_t( void huge *ptr, long nbytes, DBG_ARGS );
extern void huge *cdecl _hrelocate_d( void huge *ptr, DBG_ARGS );
extern void huge *cdecl _hrelocate_t( void huge *ptr, DBG_ARGS );
extern void *cdecl malloc_d( size_t nbytes, DBG_ARGS );
extern void *cdecl malloc_t( size_t nbytes, DBG_ARGS );
extern void near *cdecl _ncalloc_d( size_t nitems, size_t nbytes, DBG_ARGS );
extern void near *cdecl _ncalloc_t( size_t nitems, size_t nbytes, DBG_ARGS );
extern void near *cdecl _nexpand_d( void near *ptr, size_t nbytes, DBG_ARGS );
extern void near *cdecl _nexpand_t( void near *ptr, size_t nbytes, DBG_ARGS );
extern void cdecl _nfree_d( void near *ptr, DBG_ARGS );
extern void cdecl _nfree_t( void near *ptr, DBG_ARGS );
extern int cdecl _nheappack_d( DBG_ARGS );
extern int cdecl _nheappack_t( DBG_ARGS );
extern void near *cdecl _nmalloc_d( size_t nbytes, DBG_ARGS );
extern void near *cdecl _nmalloc_t( size_t nbytes, DBG_ARGS );
extern void near *cdecl _nrealloc_d( void near *ptr, size_t nbytes, DBG_ARGS );
extern void near *cdecl _nrealloc_t( void near *ptr, size_t nbytes, DBG_ARGS );
extern void near *cdecl _nrelocate_d( void near *ptr, DBG_ARGS );
extern void near *cdecl _nrelocate_t( void near *ptr, DBG_ARGS );
extern void *cdecl realloc_d( void *ptr, size_t nbytes, DBG_ARGS );
extern void *cdecl realloc_t( void *ptr, size_t nbytes, DBG_ARGS );
extern void *cdecl _relocate_d( void *ptr, DBG_ARGS );
extern void *cdecl _relocate_t( void *ptr, DBG_ARGS );
/*/
Redefine functions to activate debugging, and tracing
/*/
#if defined( _HEAPTRACE )
#if defined( MSC )
#pragma comment ( user, "Compiled with -D_HEAPTRACE -- heap tracing enabled" )
#endif
#define DBG_VALUES __FILE__, __LINE__, _HEAPTRACE
/*/
Tracing aliases: xxxxx() becomes xxxxx_t()
Any function that changes the heap must first check for errors,
and any function that allocates a heap entry must record the salient
info for heap traceback.
These functions also announce their parameters and results
/*/
#define calloc( nitems, nbytes ) calloc_t( nitems, nbytes, DBG_VALUES )
#define _expand( ptr, nbytes ) _expand_t( ptr, nbytes, DBG_VALUES )
#define _fcalloc( nitems, nbytes ) _fcalloc_t( nitems, nbytes, DBG_VALUES )
#define _fexpand( ptr, nbytes ) _fexpand_t( ptr, nbytes, DBG_VALUES )
#define _ffree( ptr ) _ffree_t( ptr, DBG_VALUES )
#define _fheappack() _fheappack_t( DBG_VALUES )
#define _fmalloc( nbytes ) _fmalloc_t( nbytes, DBG_VALUES )
#define _frealloc( ptr, nbytes ) _frealloc_t( ptr, nbytes, DBG_VALUES )
#define free( ptr ) free_t( ptr, DBG_VALUES )
#define _frelocate( ptr ) _frelocate_t( ptr, DBG_VALUES )
#define _hcalloc( nitems, nbytes ) _hcalloc_t( nitems, nbytes, DBG_VALUES )
#define _heappack() _heappack_t( DBG_VALUES )
#define _hexpand( ptr, nbytes ) _hexpand_t( ptr, nbytes, DBG_VALUES )
#define _hfree( ptr ) _hfree_t( ptr, DBG_VALUES )
#define _hheappack() _hheappack_t( DBG_VALUES )
#define _hmalloc( nbytes ) _hmalloc_t( nbytes, DBG_VALUES )
#define _hrealloc( ptr, nbytes ) _hrealloc_t( ptr, nbytes, DBG_VALUES )
#define _hrelocate( ptr ) _hrelocate_t( ptr, DBG_VALUES )
#define malloc( nbytes ) malloc_t( nbytes, DBG_VALUES )
#define _ncalloc( nitems, nbytes ) _ncalloc_t( nitems, nbytes, DBG_VALUES )
#define _nexpand( ptr, nbytes ) _nexpand_t( ptr, nbytes, DBG_VALUES )
#define _nfree( ptr ) _nfree_t( ptr, DBG_VALUES )
#define _nheappack() _nheappack_t( DBG_VALUES )
#define _nmalloc( nbytes ) _nmalloc_t( nbytes, DBG_VALUES )
#define _nrealloc( ptr, nbytes ) _nrealloc_t( ptr, nbytes, DBG_VALUES )
#define _nrelocate( ptr ) _nrelocate_t( ptr, DBG_VALUES )
#define realloc( ptr, nbytes ) realloc_t( ptr, nbytes, DBG_VALUES )
#define _relocate( ptr ) _relocate_t( ptr, DBG_VALUES )
#elif defined( _HEAPDEBUG )
#if defined( MSC )
#pragma comment ( user, "Compiled with -D_HEAPDEBUG -- heap debugging enabled" )
#endif
#define DBG_VALUES __FILE__, __LINE__, _HEAPDEBUG
/*/
Debugging aliases: xxxxx() becomes xxxxx_d()
Any function that changes the heap must first check for errors,
and any function that allocates a heap entry must record the salient
info for heap traceback.
/*/
#define calloc( nitems, nbytes ) calloc_d( nitems, nbytes, DBG_VALUES )
#define _expand( ptr, nbytes ) _expand_d( ptr, nbytes, DBG_VALUES )
#define _fcalloc( nitems, nbytes ) _fcalloc_d( nitems, nbytes, DBG_VALUES )
#define _fexpand( ptr, nbytes ) _fexpand_d( ptr, nbytes, DBG_VALUES )
#define _ffree( ptr ) _ffree_d( ptr, DBG_VALUES )
#define _fheappack() _fheappack_d( DBG_VALUES )
#define _fmalloc( nbytes ) _fmalloc_d( nbytes, DBG_VALUES )
#define _frealloc( ptr, nbytes ) _frealloc_d( ptr, nbytes, DBG_VALUES )
#define free( ptr ) free_d( ptr, DBG_VALUES )
#define _frelocate( ptr ) _frelocate_d( ptr, DBG_VALUES )
#define _hcalloc( nitems, nbytes ) _hcalloc_d( nitems, nbytes, DBG_VALUES )
#define _heappack() _heappack_d( DBG_VALUES )
#define _hexpand( ptr, nbytes ) _hexpand_d( ptr, nbytes, DBG_VALUES )
#define _hfree( ptr ) _hfree_d( ptr, DBG_VALUES )
#define _hheappack() _hheappack_d( DBG_VALUES )
#define _hmalloc( nbytes ) _hmalloc_d( nbytes, DBG_VALUES )
#define _hrealloc( ptr, nbytes ) _hrealloc_d( ptr, nbytes, DBG_VALUES )
#define _hrelocate( ptr ) _hrelocate_d( ptr, DBG_VALUES )
#define malloc( nbytes ) malloc_d( nbytes, DBG_VALUES )
#define _ncalloc( nitems, nbytes ) _ncalloc_d( nitems, nbytes, DBG_VALUES )
#define _nexpand( ptr, nbytes ) _nexpand_d( ptr, nbytes, DBG_VALUES )
#define _nfree( ptr ) _nfree_d( ptr, DBG_VALUES )
#define _nheappack() _nheappack_d( DBG_VALUES )
#define _nmalloc( nbytes ) _nmalloc_d( nbytes, DBG_VALUES )
#define _nrealloc( ptr, nbytes ) _nrealloc_d( ptr, nbytes, DBG_VALUES )
#define _nrelocate( ptr ) _nrelocate_d( ptr, DBG_VALUES )
#define realloc( ptr, nbytes ) realloc_d( ptr, nbytes, DBG_VALUES )
#define _relocate( ptr ) _relocate_d( ptr, DBG_VALUES )
#endif
#endif /* defined( HEAPDBG_H ) */